<template>
  <div class="g-wrap" v-if="HotPlaylist">
    <div class="u-cover-rank">
      <img v-lazy="HotPlaylist.picUrl" alt="">
    <span class="msk"></span>
    </div>
    <div class="m-info">
      <div class="hd">
        <i class="hd-icon-song-list"></i>
        <h2>{{HotPlaylist.name}}</h2>
      </div>
      <div class="user">
        <span class="name">
          歌手：
          <router-link :to="{name:'Work',params:{id:HotPlaylist.artist.id}}" v-if="HotPlaylist.artist">{{HotPlaylist.artist.name}}</router-link>
        </span>
        <span class="day">发行时间：{{formatDate(HotPlaylist.publishTime)}}</span>
        <span style="color: #666;">发行公司：{{HotPlaylist.company}}</span>
      </div>
      <div class="btns" v-if="HotPlaylist.info">
        <a href="javascript:;" class="ply" @click.prevent="sentSongUrl(songLists)" title="播放">
          <i class="ply">
            <em class="ply"></em>
            播放
          </i>
        </a>
        <a href="javascript:;" class="ply" title="添加到播放列表" @click.prevent="addList(songLists)"></a>
        <a href="javascript:;">
          <i class="ply">收藏</i>
        </a>
        <a href="javascript:;" >
          <i class="ply" v-if="HotPlaylist.info.commentThread.shareCount">({{HotPlaylist.info.commentThread.shareCount}})</i>
          <i class="ply" v-else>分享</i>
        </a>
        <a href="javascript:;">
          <i class="ply">下载</i>
        </a>
        <a href="javascript:;">
          <i class="ply">({{HotPlaylist.info.commentThread.commentCount}})</i>
        </a>
      </div>

    </div>
    <p class="album-desc-dot" v-if="isShow">
      <b>专辑介绍：</b><br>
      <span v-html="`&emsp;&emsp;${HotPlaylist.description.replace('&nbsp;','').slice(0,HotPlaylist.description.length/4)}...`" v-if="HotPlaylist.description"></span>
    </p>
    <p class="desc-more" v-else>
      <b>专辑介绍：</b><br>
      <span v-html="`&emsp;&emsp;${HotPlaylist.description}`" v-if="HotPlaylist.description"></span>
    </p>
    <div class="f-cb">
      <a href="javascript:;" class="zhankai" v-if="isShow" @click="changeShow('up')">展开</a>
      <a href="javascript:;" class="zhankai" v-else @click="changeShow('down')">收起</a>
      <i :class="u_icn"></i>
    </div>
  </div>
</template>

<script>
import {formatDate} from '@/utils/formatDate'

export default {
  name: "index",
  data() {
    return {
      formatDate: formatDate,
      isShow: true,
      u_icn: 'u-icn-down',

    }
  },
  methods: {
    sentSongUrl(i){
      this.$store.commit('track/addMusic',i)
      this.$store.commit('track/setNowSong',i[0])
    },
    addList(i){
      this.$store.commit('track/addMusic',i)
    },
    changeShow(str) {
      this.isShow = !this.isShow
      if (str === 'up') {
        this.u_icn = 'u-icn-up'
      } else {
        this.u_icn = 'u-icn-down'
      }
    }
  },
  computed:{
  },
  props: ['HotPlaylist','songLists'],
  mounted() {

  }
}
</script>

<style scoped lang="less">
.g-wrap {
  width: 640px;
  margin: 0 auto;
  padding-top: 40px;


  .u-cover-rank {
    width: 177px;
    height: 177px;
    float: left;
    position: relative;
.msk{
  width: 209px;
  height: 177px;
  background-position: 0 -986px;
  background-image: url("../../../assets/coverall.png");
}
    img {
      width: 177px;
      height: 177px;
    }

    span {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 208px;
      height: 208px;
      background: url("../../../assets/coverall.png") no-repeat -230px -380px;
    }
  }

  .m-info {
    width: 410px;
    //margin-top: 20px;
    margin-left: 240px;

    .hd {

      margin-bottom: 10px;
      display: flex;
      justify-items: center;
      //align-items: center;

      .hd-icon-song-list {
        display: inline-block;
        margin-right: 10px;
        width: 54px;
        height: 24px;
        overflow: hidden;
        vertical-align: middle;
        background: url("../../../assets/icon.png") no-repeat 0 -186px;
      }

      h2 {
        font-size: 20px;
        font-weight: 400;
      }
    }

    .user {
      width: 410px;
      height: 35px;
      margin-top: 10px;

      .name {
        color: #666;
        a {
          color: #0c73c2;
        }
      }

      span {
        margin-top: 5px;
        display: block;
      }

      .day {
        color: #666;
      }

      .user-img {
        width: 35px;
        height: 35px;
        vertical-align: center;
      }

      .user-icon {
        width: 13px;
        height: 13px;
      }
    }

    .btns {
      width: 483px;
      height: 31px;
      margin-top: 45px;

      .ply {
        background-repeat: no-repeat;
        background-image: url("../../../assets/button2.png");
      }

      a {
        display: inline-block;
        float: left;

        i {
          margin-right: 5px;
          font-family: simsun, \5b8b\4f53;
          color: #666;
        }

        &:nth-child(1) {

          background-position: right -428px;

          i {
            padding: 0 10px 0 8px;
            display: inline-block;
            *display: inline;
            *zoom: 1;
            height: 31px;
            line-height: 31px;
            overflow: hidden;
            *line-height: 32px;
            vertical-align: top;
            text-align: center;
            cursor: pointer;
            color: #fff;
            background-position: 0 -387px;

            em {
              float: left;
              width: 20px;
              height: 18px;
              margin: 6px 2px 2px 0;
              background-position: 0 -1622px;
            }
          }
        }

        &:nth-child(2) {
          margin-right: 5px;
          width: 31px;
          height: 31px;
          margin-left: -3px;
          padding-right: 0;
          background-position: 0 -1588px;
        }

        &:nth-child(3) {
          i {
            background-position: 0 -977px;
            float: left;
            height: 31px;
            line-height: 31px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 7px 0 28px;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
            border-right: 1px solid #C3C3C3;
          }
        }

        &:nth-child(4) {
          i {
            background-position: 0 -1225px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 7px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }

        &:nth-child(5) {
          i {
            background-position: 0 -2761px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 10px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }

        &:nth-child(6) {
          i {
            background-position: 0 -1465px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 10px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }
      }
    }



  }
  .desc-more {
    display: block;
    margin-top: 50px;
    line-height: 24px;
    font-size: 12px;
    color: #666;

    b {
      font-weight: bold;
      color: #333;
    }
  }

  .album-desc-dot {
    display: block;
    margin-top: 50px;
    line-height: 24px;
    font-size: 12px;
    color: #666;
    //width: 410px;
    //height: 180px;
    b {
      font-weight: bold;
      color: #333;
    }
  }

  .f-cb {
    width: 100%;
    text-align: right;

    .zhankai {
      color: #0c73c2;
    }

    .u-icn-down {
      display: inline-block;
      width: 11px;
      height: 8px;
      background: url("../../../assets/icon.png") no-repeat -65px -520px;
    }

    .u-icn-up {
      display: inline-block;
      width: 11px;
      height: 8px;
      background: url("../../../assets/icon.png") no-repeat -45px -520px;
    }
  }
}
</style>